package com.ysp.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.data.redis.core.ValueOperations;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author ysp
 * @date 2021/5/13 15:57
 */
@RestController
public class UserController {

    @Autowired
    private StringRedisTemplate stringRedisTemplate;

    @RequestMapping("redis")
    public String hello(){
        ValueOperations<String, String> operations = this.stringRedisTemplate.opsForValue();
        String user = operations.get("user");
        return "hello redis"+user;
    }
}
